# -*- encoding: utf-8 -*-
"""

PyCharm 08annotate函数的使用
2024年10月27日12时10分
by wenyang

文件主要内容:


"""
import numpy as np
import matplotlib.pyplot as plt


def main():
    Fs = 100
    x = np.arange(0, 10, 1 / Fs)
    y = np.sin(x)
    plt.xlim(1, 8)
    plt.ylim(-1, 1)
    plt.xlabel("Time(s)")
    plt.ylabel("Amplitude")
    plt.annotate("sin(pi/2) = 1", xy = (np.pi / 2, 1), xytext = (np.pi / 2 + 2, 0.5),
                 arrowprops = dict(facecolor = "r", shrink = 0.05))
    plt.grid(ls = "--", color = (0, 1, 0, 0.5))
    plt.plot(x, y, ls = "-", lw = 2, color = "r", label = "sin data")
    plt.legend()
    plt.show()

if __name__ == "__main__":
    main()
